package yuque.a1至20.CalculateEContinuously;

import java.util.Scanner;

/**
 * ClassName: LCMandGCD
 * Package: yuque
 * Description:
 *
 * @Author fjorid
 * @Create 2024/12/30 19:57
 * @Version 1.0
 */
class LCMCalculator {

    public static void main(String[] args) {
        int num1 ;
        int num2 ;
        Scanner scan = new Scanner(System.in);
        num2 = scan.nextInt();
        num1 = scan.nextInt();
        // 计算最大公约数
        int gcd = 1;
        int a = Math.max(num1, num2);
        int b = Math.min(num1, num2);
        while (b != 0) {
            int temp = b;
            b = a % b;
            a = temp;
        }
        gcd = a;

        // 计算最小公倍数
        int lcm = (num1 * num2) / gcd;

        System.out.println("The GCD of " + num1 + " and " + num2 + " is: " + gcd);
        System.out.println("The LCM of " + num1 + " and " + num2 + " is: " + lcm);
    }
}